define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'group/list/index',
        add_url: 'group/list/add',
        edit_url: 'group/list/edit',
        delete_url: 'group/list/delete',
        export_url: 'group/list/export',
        modify_url: 'group/list/modify',
        list_url:'group/chat/index',
        userlist_url:'group/user/index',
        createhis_url:'group/list/createhis',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh','delete','export'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'ID'},
                    //{field: 'fid', title: 'fid'},
                    {field: 'userid', title: '群主',search:false},
                    {field: 'title', title: '群名'},
                    {field: 'status', title: '禁言', templet: ea.table.switch,search:false},
                    {field: 'rank', title: '显示', templet: ea.table.switch,search:false},
                    //{field: 'time', title: 'time'},
                    {
                        width: 250,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            [{
                                text: '记录',
                                url: init.list_url,
                                method: 'open',
                                auth: 'stock',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                                extend: 'data-full="true"',
                            },{
                                text: '成员',
                                url: init.userlist_url,
                                method: 'open',
                                auth: 'stock',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                                extend: 'data-full="true"',
                            },{
                                text: '清空记录',
                                url: init.createhis_url,
                                method: 'request',
                                auth: 'stock',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                            }],
                            'edit',
                            'delete']
                    }
                    
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});